#include <bits/stdc++.h>
using namespace std;

void findPairs(int arr[], int n, int target) {
   sort(arr, arr + n); // 排序
   int i = 0, j = n - 1;
   while (i < j) {
       int sum = arr[i] + arr[j];
       if (sum == target) {
           cout << arr[i] << " " << arr[j] << endl;
           i++;
           j--;
       } else if (sum < target) {
           i++;
       } else {
           j--;
       }
   }
}

int main() {
   int arr[] = {2, 4, 6, 1, 0, 8, 10, 3};
   int n = sizeof(arr) / sizeof(arr[0]);
   int target = 10;
   findPairs(arr, n, target);
   return 0;
}